package com.lc.docker.web;

import com.lc.docker.model.Student;
import com.lc.docker.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author liuc
 * @date 2021/9/6
 * @description
 **/
@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private StudentService studentService;

    @GetMapping("/list")
    public List<Student> list(){
        return studentService.list();
    }

    @PostMapping("/add")
    public Integer add(@RequestBody Student student){
        return studentService.add(student);
    }

    @PostMapping("/del")
    public boolean del(int id){
        return studentService.del(id);
    }

    @PostMapping("/update")
    public boolean update(@RequestBody Student student){
        studentService.update(student);
        return true;
    }
}
